@{
    ViewBag.Title = "MD5在线加密工具";
    ViewBag.keywords = "MD5加密,MD5在线加密,在线工具,在线加密工具,MD5在线加密工具";
    ViewBag.description = "这是一个可以把用户输入的字符串生成32位的MD5编码的在线加密工具";var host = Appsettings.app("BaseFile:HostUrl");
}
@section Styles{<style>.md5 a{margin:5px 0;}</style>}
<div class="layui-row layui-form layui-form-pane">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" id="content" name="content" rows="8" lay-verify="required" autocomplete="off" class="layui-textarea">www.ruovea.com</textarea>
        </div>
    </div>
    <div class="layui-form-item md5">
        <a class="layui-btn u32">MD5加密(32位大写)</a>
        <a class="layui-btn l32">MD5加密(32位小写)</a>
        <a class="layui-btn u16">MD5加密(16位大写)</a>
        <a class="layui-btn l16">MD5加密(16位小写)</a>
        <a class="layui-btn layui-btn-danger cle">清空</a>
        <a class="layui-btn layui-btn-primary copy">复制结果</a>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出内容" id="outtxt" name="outtxt" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
</div>
@section Scripts{
<script src="@host/lib/md5.js"></script>
<script>
    layui.config({ base: '@host/js/' }).use('common',function(){  $=layui.jquery;
       let area_input = document.getElementById('content');
       let area_output = document.getElementById('outtxt');
       $(".md5 .u32").bind("click", function () {
           try {
               var inptxt = area_input.value;
               if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
               area_output.value =inptxt.MD5(32).toUpperCase();
           } catch (err) {
               console.log(err)
               layer.msg("加密失败", { icon: 2 });
           }
       });
       $(".md5 .l32").bind("click", function () {
           try {
               var inptxt = area_input.value;
               if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
               area_output.value =inptxt.MD5(32);
           } catch (err) {
               console.log(err)
               layer.msg("加密失败", { icon: 2 });
           }
       });
       $(".md5 .u16").bind("click", function () {
           try {
               var inptxt = area_input.value;
               if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
               area_output.value =inptxt.MD5().toUpperCase();
           } catch (err) {
               console.log(err)
               layer.msg("加密失败", { icon: 2 });
           }
       });
       $(".md5 .l16").bind("click", function () {
           try {
               var inptxt = area_input.value;
               if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
               area_output.value =inptxt.MD5();
           } catch (err) {
               console.log(err)
               layer.msg("加密失败", { icon: 2 });
           }
       });
       });
</script>
}